﻿/*
 * KRPC Exceptions
 * 
 * Author: snowdreamist
 * Date: 2011/11/25
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BitTorrentSharp.KRPC.Messages;

namespace BitTorrentSharp.KRPC
{
    public class KRPCException : Exception
    {
        public KRPCException() { }
        public KRPCException(string message) : base(message) { }
        public KRPCException(string message, Exception innerExp) : base(message, innerExp) { }
    }

    public class KRPCActiveException : KRPCException
    {
        public KRPCActiveException() { }
        public KRPCActiveException(string message) : base(message) { }
        public KRPCActiveException(string message, Exception innerExp) : base(message, innerExp) { }
    }

    public class KRPCRawSerializeException : KRPCException
    {
        public const string DefaultMessage = "Serialize/Deserialize raw byte[] data failed.";

        public KRPCRawSerializeException() { }
        public KRPCRawSerializeException(string message) : base(message) { }
        public KRPCRawSerializeException(Exception innerExp) : base(DefaultMessage, innerExp) { }
    }

    public class KRPCMessageException : KRPCException
    {
        public KRPCMessageException() { }
        public KRPCMessageException(string message) : base(message) { }
        public KRPCMessageException(string message, Exception innerExp) : base(message, innerExp) { }
    }

    public class KRPCContractLoadException : KRPCException
    {
        public KRPCContractLoadException() { }
        public KRPCContractLoadException(string message) : base(message) { }
        public KRPCContractLoadException(string message, Exception innerExp) : base(message, innerExp) { }
    }

    public class KRPCInvokeException : KRPCException
    {
        public KRPCInvokeException() { }
        public KRPCInvokeException(string message) : base(message) { }
        public KRPCInvokeException(string message, Exception innerExp) : base(message, innerExp) { }
    }

    public class KRPCParameterMismatch : KRPCException
    {
        public KRPCParameterMismatch() { }
        public KRPCParameterMismatch(string message) : base(message) { }
        public KRPCParameterMismatch(string message, Exception innerExp) : base(message, innerExp) { }
    }

    /// <summary>
    /// Represents the error of remote server
    /// </summary>
    public class KRPCServiceException : KRPCException
    {
        public KRPCServiceException(ErrorType errorType, string message)
            : base(message)
        {
            this.Type = errorType;
        }

        public ErrorType Type { get; private set; }
    }


}
